package etnorservice.etnor_service.mapper.projectMapper;



import etnorservice.etnor_service.domain.ProjectScreenshot;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProjectScreenshotMapper {
    @Insert("INSERT INTO project_screenshots(project_id, image_path, display_order, created_at) " +
            "VALUES(#{projectId}, #{imagePath}, #{displayOrder}, NOW())")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(ProjectScreenshot screenshot);

    @Select("SELECT * FROM project_screenshots WHERE project_id = #{projectId} ORDER BY display_order")
    List<ProjectScreenshot> findByProjectId(Long projectId);

    @Delete("DELETE FROM project_screenshots WHERE project_id = #{projectId}")
    int deleteByProjectId(Long projectId);
}
